<template>
  <div style="user-select: none">
    <span v-for="(item, index) in arr" :key="index">
      <input
        v-model="newArr"
        :value="item"
        type="checkbox"
        :id="`ck${index}`"
      />
      <label :for="`ck${index}`">{{ item }}</label>
    </span>
    <hr />
    选中元素的和为：{{ total }}
  </div>
</template>

<script>
export default {
  name: 'Xzszqh',
  components: {},
  data() {
    return {
      arr: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
      newArr: [],
    }
  },
  computed: {
    total() {
      return this.newArr.reduce((acc, cur) => acc + cur, 0)
    },
  },
  watch: {},
  created() {},
  mounted() {},
  methods: {},
}
</script>

<style lang="less" scoped></style>
